package com.ykl.cas.utils;

import java.util.HashMap;
import java.util.Map;

public class JSONUtils {
  public static String responseMsg(String msg) {
    String result = "{\"msg\":\"" + msg + "\"}";
    return result;
  }

  public static String responseMap(HashMap<Object, Object> map) {
    StringBuilder stringBuilder = new StringBuilder("{");
    for (Map.Entry<Object, Object> entry : map.entrySet()) {
      stringBuilder.append("\"")
              .append(entry.getKey())
              .append("\"")
              .append(":")
              .append("\"")
              .append(entry.getValue())
              .append("\"")
              .append("}");
    }
    return stringBuilder.toString();
  }
}
